<template>
	<view class="realname page bgff px30 py12">
		
		<view class="fs16 bold6 mt30 mb18">请核对姓名及身份证号码是否正确:</view>
		<view class="bg px20 py16">
			<view class="flex flexC">
				<text class="mr20">姓名</text>
				<input type="text" v-model="name" placeholder="请填写姓名">
			</view>
			<view class="flex flexC mt14">
				<text class="mr20">身份证号码</text>
				<input type="idcard" v-model="idcard" placeholder="请填写身份证号码">
			</view>
		</view>
		<button @click="addUserVerify" hover-class="none" class="btn bg41 r40 fs14  m20">实名认证</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentType: 'front',
				frontUrl: '/static/imgs/bg/idcard.png',
				frontPath: '',
				backUrl: '/static/imgs/bg/idcard2.png',
				backPath: '',
				uploadUrl: '',
				name: '',
				idcard: '',
				bizToken: ''
			};
		},
		onLoad(option) {

			console.info(option.info);
		
		
		},
		methods: {



			addUserVerify() {
				let param = {
					idcard: this.idcard,
					name: this.name,
				}
				if( this.name == ''){
					uni.showToast({title:"请填写姓名",icon:'none'});
					return;
				}
				if( this.idcard == ''){
					uni.showToast({title:"请填写身份证号",icon:'none'});
					return;
				}
				
				let that = this;
				this.$api.verify(param).then(res => {
					console.info(res);

					if (res.code == 1) {

						uni.showModal({
							title:"认证提示",
							content:"实名认证成功",
							showCancel:false,
							success(res) {
								uni.navigateBack({
									delta:1
								})
							}
						})
					
						
					} else {
						uni.showToast({
							icon: 'none',
							title: res.msg
						})
					}
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.realname {
		.bg {
			background-color: #F5F8FF;
		}

		.btn {
			background-color: #FD449B;
			color: #fff;
			height: 80rpx;
			line-height: 80rpx;
		}

		.w140 {
			width: 280rpx;
		}
	}
</style>
